<?php
namespace app\servergoods\service\goods;
use \app\manage\service\ApiBase;

class GoodsCategoryAttrs extends ApiBase
{
	protected $goodsCategoryAttrsLogic = 'app\servergoods\logic\GoodsCategoryAttrs';
	protected $goodsCategoryAttrsValidate = 'app\servergoods\validate\GoodsCategoryAttrs';
	/*获取属性列表*/
	public function attrsList(): array
	{
		$data = $this->haveIssetReceiveData(['page'=>1,'listRows'=>15,'name'=>'','attr_type'=>'']);
		return $this->oneStepRun($data,'servergoods/goods/GoodsCategoryAttrs/attrsList','attrsList');
	}
	/*获取属性列表不分页*/
	public function attrsAllList(): array
	{
		$data = $this->haveIssetReceiveData(['name'=>'','attr_type'=>'']);
		return $this->oneStepRun($data,'servergoods/goods/GoodsCategoryAttrs/attrsAllList','attrsList');
	}
	/*获取某属性信息*/
	public function oneAttrInfo(): array
	{
		$data = $this->receiveData(['id'=>0]);
        return $this->oneStepRun($data,'servergoods/goods/GoodsCategoryAttrs/oneAttrInfo','oneAttrInfo');
	}

	/*添加属性*/
	public function addAttr(): array
	{
        $data = $this->receiveData([
		'name'=>' ','en_name'=>' ','attr_type'=>' ','attr_values'=>'','default_value'=>'',
		'is_filter'=>' ','is_show'=>' ','show_position'=>' ','search_flag'=>' ','order'=>100
		]);
        return $this->oneStepRun($data,'servergoods/goods/GoodsCategoryAttrs/addAttr','addAttr');
	}

	/*编辑属性*/
	public function editAttr()
	{
		$data = $this->issetReceiveData([
		'id'=>0,'name'=>' ','en_name'=>' ','attr_type'=>' ','attr_values'=>'','default_value'=>'',
		'is_filter'=>' ','is_show'=>' ','show_position'=>' ','search_flag'=>' ','order'=>100
		]);
        return $this->oneStepRun($data,'servergoods/goods/GoodsCategoryAttrs/editAttr','editAttr');
	}

	//删除一个或多个属性
    public function delAttrs()
	{
        $data = $this->receiveData(['id'=>[]]);
        return $this->oneStepRun($data,'servergoods/goods/GoodsCategoryAttrs/delAttrs','delAttrs');
    }
}
